{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 引包\n",
    "from sklearn import datasets, cross_validation, naive_bayes\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据加载方法：\n",
    "def load_data():\n",
    "    digits=datasets.load_digits()\n",
    "    return cross_validation.train_test_split(digits.data, digits.target, test_size=0.25, random_state=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 多项式贝叶斯 条件概率满足多项式分布 加入拉普拉斯平滑\n",
    "def test_MultinomialNB(*data):\n",
    "    train_x,test_x, train_y, test_y = data\n",
    "    cls = naive_bayes.MultinomialNB()\n",
    "    cls.fit(train_x,train_y)\n",
    "    print('Training Score: {0}'.format(cls.score(train_x,train_y)))\n",
    "    print('Testing Score: {0}'.format(cls.score(test_x,test_y)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Training Score: 0.9064587973273942\n",
      "Testing Score: 0.9088888888888889\n"
     ]
    }
   ],
   "source": [
    "# 查看多项式贝叶斯训练结果：\n",
    "train_x,test_x, train_y, test_y = load_data()\n",
    "test_MultinomialNB(train_x, test_x, train_y, test_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看不同的拉普拉斯平滑 对结果的影响：\n",
    "def test_MultinomialNB_alpha(*data):\n",
    "    train_x,test_x, train_y, test_y = data\n",
    "    alphas = np.logspace(-2, 5 ,num=200)\n",
    "    train_score = []\n",
    "    test_score = []\n",
    "    for alpha in alphas:\n",
    "        cls = naive_bayes.MultinomialNB(alpha=alpha)\n",
    "        cls.fit(train_x,train_y)\n",
    "        train_score.append(cls.score(train_x,train_y))\n",
    "        test_score.append(cls.score(test_x,test_y))\n",
    "            \n",
    "    # 绘图：\n",
    "    fig = plt.figure()\n",
    "    ax = fig.add_subplot(111)\n",
    "    ax.plot(alphas,train_score,label='Training Score')\n",
    "    ax.plot(alphas,test_score, label='Testing Score')\n",
    "    ax.set_xlabel(r'$\\alpha$')\n",
    "    ax.set_ylabel('score')\n",
    "    ax.set_ylim(0,1.0)\n",
    "    ax.set_title('MultinomialNB')\n",
    "    ax.set_xscale('log')\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEaCAYAAAD+E0veAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHTZJREFUeJzt3Xl8XQWd9/HPLzdbszVtky60SRfa0EW2GiuIYpGCbFOUUQQZHX0x9MEBnWceHxV1HpxBZ1ye0Rl9gQuoAyKLlRGfAmUARQQcim1tC3SDUkubtnShbdqkSW6S+3v+OKeH25Dlps3JzU2/79crr96z3HO/OVzuN+ece84xd0dERAQgL9sBRERk6FApiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgJwQzczOb3sv0tWY2fxAj9ft1+/odRAaCSkGGPDPbYmZJM6vqMn5V+EE5pZ/Lu9PMvpY+zt3nuPtTxx22n471dcPfwc1sXtq46WbmacNPmVmrmTWZWaOZPW1mpw5QdBmmVAqSK/4MXH1kIPxwK8lenCFhH/C1Pua50d3LgNHAU8DdcYeS3KZSkFxxN/DxtOG/Bn52ZCD8q/hv0oY/YWbPdl2ImS0CrgE+H/4F/VA4fouZLQgf/6OZLTazn5nZoXAXT33aMmaFr3cgnLYwbdqdZvZ9M3s0XP4fzGy8mf27me03sw1mdmba/OmvO8/M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ASHWwWEcmeOEthOTDDzKaaWSFwFbDkyER3b3T3Knef4u5TgGXAQndfEWMmERHpRWyl4O4dwI0E10xaDyx297VmdouZLYzrdUVE5NhlepOdY+LuS4GlXcbd3MO88+PMIiIifdMZzSIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIRKUgIiIRlYKIiERUCiIiElEpiIhIJNZSMLOLzGyjmW0ys5u6mf6/zGydmb1gZr81s8lx5hERkd7FVgpmlgBuAy4GZgNXm9nsLrOtAurd/TTgAeBbceUREZG+xbmlMA/Y5O6b3T0J3A9cnj6Du//O3Q+Hg8uASTHmERGRPsRZChOBbWnDDeG4nlwLPBpjHhER6UN+tgMAmNlfAfXAe3uYvghYBFBbWzuIyURETixxbilsB2rShieF445iZguALwML3b2tuwW5++3uXu/u9dXV1bGEFRGReEthOTDDzKaaWSFwFbAkfQYzOxP4EUEh7I4xi4iIZCC2UnD3DuBG4DFgPbDY3dea2S1mtjCc7f8CZcAvzWy1mS3pYXEiIjIIYj2m4O5LgaVdxt2c9nhBnK8vIiL9ozOaRUQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCIqBRERiagUREQkolIQEZGISkFERCKxloKZXWRmG81sk5nd1M30IjP7RTj9eTObEmceERHpXWylYGYJ4DbgYmA2cLWZze4y27XAfnefDvwb8M248oiISN/i3FKYB2xy983ungTuBy7vMs/lwF3h4weA883MYswkIiK9yI9x2ROBbWnDDcA7e5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0QONPMvhh3uF70lPtXwF+a2Q84vlP0B1K3WYfQuuyqp3Wb7fdqd3pat/PN7Htm9iNgaXaidavbvO7+ZXf/nwTldcdgFkIvelq3V4Tr9W7g1oF6sWGxpTAQ3P17wPeynSNT7v4GwT7lIcndm4FPZjtHJob6uuwql96r7v4U8FSWY/Sbu9+Z7Qx9cfdfEfzxNaCG85ZCJhfkG0pyLe8RuZQ7l7JCbuXNpayQW3kHNetwLoXlwAwzm2pmhQQHj5ZkOVNvci3vEbmUO5eyQm7lzaWskFt5BzdrNr4NEMMR+/uAnUA7wf62a8PxlxBcqfVV4MvZzpmreXMxdy5lzbW8uZQ11/IOhay6IJ6IiESG8+4jERHpJ5WCiIhEVAoiIhJRKYiISESlICIiEZWCiIhEVAoiIhJRKYiISEQXxBM5TmY2B/guUEtwxcqxwM/cfXlWg4kcA53RLHIczKwY+BPwYWAzsAFY6e5XZDWYyDHSloLI8VkArHL3tQDhBcu+nd1IIsdOxxREjs8ZwCoAMzsJaHL3P2Q3ksixUymIHJ8kb94h7+sE99AVyVkqBZHjcy9wrpltJLih+nNm9u9ZziRyzHSgWUREItpSEBGRiEpBREQiKgUREYmoFEREJKJSEBGRiEpBREQiKgUREYmoFEREJPL/AZHXJFFnFP2cAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 查看多项式贝叶斯训练结果：\n",
    "train_x,test_x, train_y, test_y = load_data()\n",
    "test_MultinomialNB_alpha(train_x, test_x, train_y, test_y)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
